<?php
include "konek.php";
$prit =date('Y/m/d');
$ax = date('Y-m').'-01';
$bx = date('Y-m').'-09';
echo $bx;
//;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$xp =mysql_query("SELECT *,count(*) as A from ticket where open_datetime between '$ax' and '$bx' and severity_level in('Medium') group by(severity_level)");
$xp1 = mysql_fetch_array($xp);
$Medium1 = $xp1['A'];

$xpa =mysql_query("SELECT *,count(*) as A from ticket where open_datetime between '$ax' and '$bx' and severity_level in('Low') group by(severity_level)");
$xp1a = mysql_fetch_array($xpa);
$Low1 = $xp1a['A'];

$xpa1 =mysql_query("SELECT *,count(*) as A from ticket where open_datetime between '$ax' and '$bx' and severity_level in('High') group by(severity_level)");
$xp1a1 = mysql_fetch_array($xpa1);
$High1 = $xp1a1['A'];

//;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$ax2 = date('Y-m').'-09';
$bx2 = date('Y-m').'-16';
$xp2 =mysql_query("SELECT count(*) as A from ticket where open_datetime between '$ax2' and '$bx2' and severity_level in('Low') group by(severity_level)");
$xp12 = mysql_fetch_array($xp2);
$Low2 = $xp12['A'];

$xp2a =mysql_query("SELECT count(*) as A from ticket where open_datetime between '$ax2' and '$bx2' and severity_level in('Medium') group by(severity_level)");
$xp12a = mysql_fetch_array($xp2a);
$Medium2 = $xp12a['A'];

$xp2ab =mysql_query("SELECT count(*) as A from ticket where open_datetime between '$ax2' and '$bx2' and severity_level in('High') group by(severity_level)");
$xp12ab = mysql_fetch_array($xp2ab);
$High2 = $xp12ab['A'];

//;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$ax3 = date('Y-m').'-16';
$bx3 = date('Y-m').'-25';
$xp3 =mysql_query("SELECT count(*) as A from ticket where open_datetime between '$ax3' and '$bx3' and severity_level in('Low') group by(severity_level)");
$xp13 = mysql_fetch_array($xp3);
$Low3= $xp13['A'];

$xp3a =mysql_query("SELECT count(*) as A from ticket where open_datetime between '$ax3' and '$bx3' and severity_level in('Medium') group by(severity_level)");
$xp13a = mysql_fetch_array($xp3a);
$Medium3= $xp13a['A'];

$xp3ab =mysql_query("SELECT count(*) as A from ticket where open_datetime between '$ax3' and '$bx3' and severity_level in('High') group by(severity_level)");
$xp13ab = mysql_fetch_array($xp3ab);
$High3= $xp13ab['A'];

//;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$ax4 = date('Y-m').'-25';
$bx4 = date('Y-m').'-31';
$xp4 =mysql_query("SELECT count(*) as A from ticket where open_datetime between '$ax4' and '$bx4' and and severity_level in('Low') group by(severity_level)'");
$xp14 = mysql_fetch_array($xp4);
$Low4 = $xp14['A'];

$xp4a =mysql_query("SELECT count(*) as A from ticket where open_datetime between '$ax4' and '$bx4' and and severity_level in('Medium') group by(severity_level)'");
$xp14a = mysql_fetch_array($xp4a);
$Medium4 = $xp14a['A'];

$xp4ab =mysql_query("SELECT count(*) as A from ticket where open_datetime between '$ax4' and '$bx4' and and severity_level in('High') group by(severity_level)");
$xp14ab = mysql_fetch_array($xp4ab);
$High4 = $xp14ab['A'];


echo $aa;

echo "

<graph xAxisName='Severity Level by Month' yAxisName='' caption='Severity Level Average' subCaption='( $prit )' 
 decimalPrecision='0' rotateNames='1' numDivLines='3' numberPrefix='' showValues='0' formatNumberScale='0'>
	<categories>
		<category name='Week 1' />
		<category name='Week 2' />
		<category name='Week 3' />
		<category name='Week 4' />

	</categories>
	<dataset seriesName='Low' color='AFD8F8' showValues='0'>
		<set value='$Low1' />
		<set value='$Low2' />
		<set value='$Low3' />
		<set value='$Low4' />
		
	</dataset>
	<dataset seriesName='Medium'  color='F6BD0F' showValues='0'>
		<set value='$Medium1' />
		<set value='$Medium2' />
		<set value='$Medium3' />
		<set value='$Medium4' />
		
	</dataset>
	<dataset seriesName='High' color='8BBA00' showValues='0'>
		<set value='$High1' />
		<set value='$High2' />
		<set value='$High3' />
		<set value='$High4' />
		
	</dataset>
</graph>



";

?>